package opdracht3;

/**
 * A viewer that does not buy anything in the auto show.
 * 
 * @author Sander & Dave
 * 
 */
public class Viewer extends Visitor {

	public Viewer(String name, Autoshow show) {
		super(name, show);
	}

	public void run() {
		while (true) {
			try {
				// Viewer is just living his life until he decides to visit the
				// autoshow.
				justLive();
				// Reports to the autoshow that he wants to visit.
				getShow().visit();
				// Wander around the show.
				roamShow();
				// Reports that he is leaving the autoshow.
				getShow().leave();
			} catch (InterruptedException e) {

			}
		}
	}

	/**
	 * Method to represent the viewer to wander around the autoshow.
	 */
	public void roamShow() {
		try {
			System.out.println(super.getName()
					+ " is walking around on the autoshow.");
			Thread.sleep((int) (Math.random() * 10000));
		} catch (InterruptedException e) {

		}
	}

}
